<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta charset="UTF-8">
<title>会员充值</title>
<meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" name="viewport">
<meta content="yes" name="apple-mobile-web-app-capable">
<meta content="black" name="apple-mobile-web-app-status-bar-style">
<meta content="telephone=no" name="format-detection">
<link href="/carworld_weixin/css/recharge.css" rel="stylesheet" type="text/css">
<script src="/carworld_weixin/js/jquery-3.3.1.min.js"></script>
<style type="text/css">
.tb960x90 {
	display: none !important;
	display: none
}
</style>
</head>
<body>
	<section class="aui-flexView">
		<section class="aui-scrollView">
			<div class="aui-flex aui-flex-gradual">
				<div class="aui-flex-user">
					<img src="" alt="">
				</div>
				<div class="aui-flex-box">
					<h2></h2>
					<p>
						<em id="card_balance"></em>
					</p>
				</div>
				<div class="aui-flex-Member">
					<p></p>
				</div>
			</div>
			<div class="aui-flex-member-list">
				<h2>盛大开业，充值优惠活动</h2>
				<ul class="aui-cho-box">
					
					<li class="aui-flex">
						<div class="aui-flex-box">
							<h3>
								充值优惠
								<em class="aui-flex-box-tj">
									<img src="/carworld_weixin/images/icon-png/icon-tj.png" alt="">
								</em>
							</h3>
							<p>充100元送30元，秒到即得130元</p>
						</div>
						<div class="aui-original-thj">
							特惠价
							<i>￥</i>
						</div>
						<i class="aui-price">100</i>
						<span style="display: none">30</span>
					</li>
					
					<!-- <li class="aui-flex">
						<div class="aui-flex-box">
							<h3>茉德精品火锅内部充值测试</h3>
							<p>（正式上线后删）</p>
						</div>
						<div class="aui-original-thj">
							特惠价
							<i>￥</i>
						</div>
						<i class="aui-price">1</i>
						<span style="display: none">0</span>
					</li> -->
					<li class="aui-flex">
						<div class="aui-flex-box">
							<h3>活动详情</h3>
							<span>
								1、充值优惠，越充越值；
								<br>
								2、充值优惠活动暂不限定截止时间；
								<br>
							</span>
						</div>
					</li>
				</ul>
				<p>
					充值套餐总价：
					<span id="total">130</span>
					元
				</p>
				<p class="aui-total b-line">
					实际支付：
					<span>100</span>
					元
				</p>
				<div class="chi">
					<div class="aui-flex b-line" style="padding: 15px 0">
						<div class="aui-flex-wx">
							<img src="/carworld_weixin/images/icon-png/icon-wx.png" alt="">
						</div>
						<div class="aui-flex-box aui-flex-box-clear">
							<h4>
								微信支付
								<em class="aui-flex-box-tj">
									<img src="/carworld_weixin/images/icon-png/icon-tj.png" alt="">
								</em>
							</h4>
							<p>亿万用户的选择，更快更安全</p>
						</div>
						<div class="aui-payment-method">
							<label class="cell-right">
								<input type="radio" name="radio" value="wx" checked="checked">
								<i class="cell-radio-icon"></i>
							</label>
						</div>
					</div>
					<!-- <div class="aui-flex b-line" style="padding: 15px 0">
						<div class="aui-flex-wx">
							<img src="%E4%BC%9A%E5%91%98%E5%85%85%E5%80%BC_files/icon-zfb.png" alt="">
						</div>
						<div class="aui-flex-box">
							<h4>支付宝支付</h4>
							<p>亿万用户的选择</p>
						</div>
						<div class="aui-payment-method">
							<label class="cell-right">
								<input type="radio" name="radio" value="zfb">
								<i class="cell-radio-icon"></i>
							</label>
						</div>
					</div> -->
				</div>
			</div>
		</section>
		<footer class="aui-tabBar aui-tabBar-fixed" >
			<button class="aui-tabBar-btn">立即充值</button>
		</footer>
	</section>
	<script>
		
	</script>
	<script type="text/javascript">
		$(function() {
			$.ajax({
				type : 'GET',
				url : '/carworld_weixin/user/getUserInfo',
				dataType : 'json',
				contentType : 'application/json',
				success : function(data) {
					console.log(data);
					$('.aui-flex-box h2').text(data.user.user_nickname);
					$('.aui-flex-user img').attr("src", data.user.user_photo); 
					if(null == data.card){
						alert('您还没有会员卡，领取公众号菜单栏五元优惠券后即可办理会员卡');
						 $('.aui-tabBar-btn').hide();
						return;
					}
					if (null == data.user.mobile || null == data.user.name) {
						alert('您还没有完成会员注册，立即前往~')
						window.location.href = '/carworld_weixin/pages/page_supplyInfo.html';
					} else {
						$('#card_balance').text('会员卡余额：' + data.card.amt + '元');
					}
					$('aui-flex-Member p').text(data.shop.name + '尊享会员');
				}
			});

		});

		$(document).ready(function(e) {
			$(".aui-cho-box li").click(function() {
				$(this).addClass("on").siblings().removeClass("on");
				tola();
			});

		});

		function tola() {
			var $li = $(".aui-cho-box").children("li.on");
			var money = $li.children("i").text();
			var giving = $li.children("span").text();
			$("#total").text(parseInt(money) + parseInt(giving));
			$(".aui-total span").text(money);
		}

		$('.aui-tabBar-btn').click(function() {
			var money = $(".aui-total span").html();
			var giving = $("#total").html()- money;
			alert("充值金额￥："+money+",赠送金额￥:"+giving);
			href = "http://food.3kkk.xyz/carworld_weixin/recharge/pre?money=" + money + "&giving=" + giving;
			console.log('href---》' + href);
			window.location.href = href;
		});
	</script>
</body>
</html>